#include <cstdio>


typedef unsigned int uint;


#define TOTAL_CONTAINERS 3
#define TOTAL_PERMUTATIONS 6

enum COLOR
{
	B, G, C,
	TOTAL_COLORS
};


struct Permutation
{
	COLOR color;
	uint count;
};


Permutation permutation[TOTAL_PERMUTATIONS][TOTAL_COLORS] = {
	{{B}, {C}, {G}},
	{{B}, {G}, {C}},
	{{C}, {B}, {G}},
	{{C}, {G}, {B}},
	{{G}, {B}, {C}},
	{{G}, {C}, {B}}
};

uint sum_permutation[TOTAL_PERMUTATIONS];

uint input[TOTAL_CONTAINERS][TOTAL_COLORS];

const char *output[TOTAL_PERMUTATIONS] = {
	"BCG ",
	"BGC ",
	"CBG ",
	"CGB ",
	"GBC ",
	"GCB "
};


inline bool get_input ()
{
	return scanf (
		"%u %u %u %u %u %u %u %u %u",
		&input[0][0], &input[0][1], &input[0][2],
		&input[1][0], &input[1][1], &input[1][2],
		&input[2][0], &input[2][1], &input[2][2]
		) == 9;
}


inline uint best_permutation ()
{
	uint per, r, i, color, con, container;

	for (per = 0; per < TOTAL_PERMUTATIONS; ++per)
	{
		uint &sum = sum_permutation[per] = 0;
		for (con = 0; con < TOTAL_CONTAINERS; ++con)
		{
			Permutation &p = permutation[per][con];
			p.count = 0;
			for (container = 0; container < TOTAL_CONTAINERS; ++container)
			{
				if (con == container)
					continue;

				for (color = 0; color < TOTAL_COLORS; ++color)
				{
					if (p.color == color)
						sum += input[container][color];
				}
			}
		}
	}

	for (r = 0, i = 1; i < TOTAL_PERMUTATIONS; ++i)
	{
		if (sum_permutation[r] > sum_permutation[i])
			r = i;
	}

	return r;
}


int main ()
{
	uint r;

	while (get_input ())
	{
		r = best_permutation ();
		fputs (output[r], stdout);
		printf("%u\n", sum_permutation[r]);

	}

	return 0;
}